#include <dirent.h>
#include <libgen.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>


void current_time_format_hour(uint8_t *curTime)
{
    if (curTime == NULL)
    {
        return;
    }
    struct timeval tv;
    struct timezone tz;
    struct tm tp;

    gettimeofday(&tv, &tz);
    localtime_r(&tv.tv_sec, &tp);
    sprintf((char *)curTime,
            "%04d-%02d-%02d-%02d",
            tp.tm_year + 1900,
            tp.tm_mon + 1,
            tp.tm_mday,
            tp.tm_hour);
}

int main(int argc, char *argv[])
{

    // 每天2点、12点、22点，检验文件，超时删除
    // 获取当期精确到小时的时间
    uint8_t current_time[] = "xxxx-xx-xx-xx";
    current_time_format_hour(current_time);

    if ((std::string((char *)current_time + strlen("xxxx-xx-xx-xx") - 1) == "2") and (flag))
    {}

    return 0;
}
